function probability = convertToProbability(nn, alpha, sumAlpha, Py, Prck, xtest, ytest, dim)

probability = (alpha(1) + Prck(xtest(nn,dim)+1, ytest(nn,:)+1, dim))/(sumAlpha + Py(ytest(nn,:)+1));